<!DOCTYPE html>
<html lang="ch">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>卖仔牛啤</title>

    <link rel="stylesheet" href="css/index.css">
    <script src="js/jquery-1.11.0.min.js"></script>
    <script src="js/common.js"></script>
    <script>
        var ID = getParameter("id");

        function getDirectoryList(id) {
            var url = "s/directoryList";
            if (id) {
                url += "/" + id;
            }
            $.get(
                url,
                {},
                function (list) {
                    var content = "";

                    $.each(list, function (index, obj) {
                        if (obj.size > 0) {
                            content += '<a href="view.html?id=' + obj.id + '&pageSize=' + obj.size + '">' +
                                    '<div class="dir-list">' +
                                    '<img src="s/thumbnail/' + obj.id + '">' +
                                    '<span>' + obj.name + '</span>' +
                                    '</div>' +
                                    '</a>';
                        } else {
                            content += '<a href="index.html?id=' + obj.id + '">' +
                                    '<div class="dir-list">' +
                                    '<img src="img/directory/1230162.gif">' +
                                    '<span>' + obj.name + '</span>' +
                                    '</div>' +
                                    '</a>';
                        }
                    });

                    $(".dir-container").html(content);
                },
                "json"
            );
        }

        $(function () {
            getDirectoryList(ID);
        });
    </script>
</head>

<body>
    <div class="container">
        <div class="dir-container">
            <a href="view.html?id=0">
                <div class="dir-list">
                    <img src="img/directory/1230162.gif">
                    <span>{{obj.name}}</span>
                </div>
            </a>
        </div>
    </div>

</body>

</html>